{php include wl_template('common/header');}
<style>
	.form-group{margin-bottom: 10px!important;}
</style>
<ul class="nav nav-tabs">
	<li ><a href="{php echo web_url('member/wlMember/memberIndex')}">客户列表</a></li>
	<li class="active"><a href="{php echo web_url('member/wlMember/memberDetail',array('id'=>intval($_GPC['id'])))}">客户详情</a></li>
</ul>
<div class="app-content">
	<div class="app-form">
		<form action="" method="post" class="form-horizontal form form-validate" enctype="multipart/form-data">
			<div class="row">
				<div class="col-md-6">
					<div class="form-group-title">用户信息</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">粉丝</label>
						<div class="col-sm-9">
							<img class="radius50" src="{$member['avatar']}" style='width:50px;height:50px;padding:1px;border:1px solid #ccc' onerror="this.src='{IMAGE_NOPIC_SMALL}'"/>
							{if strexists($member['openid'],'sns_wa')}<i class="icow icow-xiaochengxu" style="color: #7586db;vertical-align: middle;" data-toggle="tooltip" data-placement="bottom" data-original-title="来源: 小程序"></i>{/if}
							{if strexists($member['openid'],'sns_qq')||strexists($member['openid'],'sns_wx')||strexists($member['openid'],'wap_user')}<i class="icow icow-app" style="color: #44abf7;vertical-align: middle;" data-toggle="tooltip" data-placement="bottom" data-original-title="来源: 全网通({if strexists($member['openid'],'wap_user')}手机号注册{else}APP{/if})"></i>{/if}
							{$member['nickname']}
						</div>
					</div>
					{if !empty($member['openid'])}
					<div class="form-group">
						<label class="col-sm-2 control-label">公众号OPENID</label>
						<div class="col-sm-9">
							<div class="form-control-static js-clip text-primary" data-url="{$member['openid']}">{$member['openid']}</div>
						</div>
					</div>
					{/if}
					{if !empty($member['wechat_openid'])}
					<div class="form-group">
						<label class="col-sm-2 control-label">小程序OPENID</label>
						<div class="col-sm-9">
							<div class="form-control-static js-clip text-primary" data-url="{$member['wechat_openid']}">{$member['wechat_openid']}</div>
						</div>
					</div>
					{/if}
					{if !empty($member['unionid'])}
					<div class="form-group">
						<label class="col-sm-2 control-label">统一用户ID</label>
						<div class="col-sm-9">
							<div class="form-control-static js-clip text-primary" data-url="{$member['unionid']}">{$member['unionid']}</div>
						</div>
					</div>
					{/if}
					<div class="form-group">
						<label class="col-sm-2 control-label">积分</label>
						<div class="col-sm-3">
							<div class='form-control-static'>{$member['credit1']}
								<a data-toggle='ajaxModal' href="{php echo web_url('member/wlMember/memberRecharge', array('type'=>'credit1','id'=>$member['id']))}" style="padding-left: 5px;">充值</a>
							</div>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">余额</label>
						<div class="col-sm-3">
							<div class='form-control-static'>{$member['credit2']}
								<a data-toggle='ajaxModal' href="{php echo web_url('member/wlMember/memberRecharge', array('type'=>'credit2','id'=>$member['id']))}" style="padding-left: 5px;">充值</a>
							</div>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">注册时间</label>
						<div class="col-sm-9">
							<div class='form-control-static'>{php echo date("Y-m-d H:i:s",$member['createtime'])}</div>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">关注状态</label>
						<div class="col-sm-9">
							<div class='form-control-static'>
								{if empty($member['follow'])}
								{if empty($member['unfollowtime'])}
								<label class='label label-default'>未关注</label>
								{else}
								<label class='label label-warning'>取消关注</label>
								{/if}
								{else}
								<label class='label label-success'>已关注</label>
								{/if}
							</div>
						</div>
					</div>
					{if !empty($pocketlevellist)}
					<div class="form-group">
						<label class="col-sm-2 control-label">掌上信息等级</label>
						<div class="col-sm-4">
							<select name="data[pocketlevelid]" class="form-control">
								<option value="0">无等级</option>
								{loop $pocketlevellist $level}
								<option value="{$level['id']}" {if $member['pocketlevelid'] == $level['id']}selected="selected"{/if}>{$level['name']}</option>
								{/loop}
							</select>
						</div>
					</div>
					{/if}
					{if p('distribution')}
					<div class="form-group">
						<label class="col-sm-2 control-label">推荐人</label>
						<div class="col-sm-6">
							<div class='form-control-static'>
								{$member['leadname']}
								<a href="{php echo web_url('distribution/dissysbase/changeleadid',array('id'=>$member['id']))}" onclick="setTimeout(de,1500);" data-toggle="ajaxModal"> - 修改</a>
							</div>
						</div>
					</div>
					{/if}
					<div class="form-group">
						<label class="col-sm-2 control-label">用户标签</label>
						<div class="col-sm-9">
							<div class='form-control-static'>
								{loop $labels $lab}
								<label  class='label label-success'>{$lab['name']}</label><label class='label label-warning'>{$lab['times']}</label>
								{/loop}
							</div>
						</div>
					</div>

				</div>
				<div class="col-md-6">
					<div class="form-group-title">用户绑定</div>
					<div class="alert alert-warning">以下信息修改后会可能导致用户无法登录WAP端，如需更改请告知该用户！</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">真实姓名</label>
						<div class="col-sm-9">
							{php echo tpl_form_field_editor(array('name'=>'data[realname]', 'value'=>$member['realname']))}
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">手机号码</label>
						<div class="col-sm-9">

							{if empty($member['mobile'])}
							{php echo tpl_form_field_editor(array('name'=>'data[mobile]', 'value'=>$member['mobile']))}
							{else}
							<input type="text" name="data[mobile]" class="form-control" value="{$member['mobile']}" />
							{/if}
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">用户密码</label>
						<div class="col-sm-9">
							{php echo tpl_form_field_editor(array('name'=>'data[password]', 'value'=>''))}
							<div class="form-control-static">密码留空则不修改</div>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label"></label>
						<div class="col-sm-9">
							<input type="submit" value="提交" class="btn btn-primary min-width" />
							<input type="hidden" name="token" value="{$_W['token']}" />
						</div>
					</div>
				</div>
			</div>
		</form>
	</div>
</div>
<script>
	function de(){
		myrequire(['select2'], function() {
			console.log('111');
			$('.chosen-select').select2({
				ajax: {
					url: "{php echo web_url('distribution/dissysbase/getuser')}",
					dataType: 'json',
					data: function (params) {
						var query = { //请求的参数, 关键字和搜索条件之类的
							search: params.term //select搜索框里面的value
						}
						// Query paramters will be ?search=[term]&page=[page]
						return query;
					},
					processResults: function (data) {
						return {
							results: data  //必须赋值给results并且必须返回一个obj
						};
					}
				}
			});
		});
	}
</script>
{php include wl_template('common/footer');}